-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Use var instead of const in sanitizer to partially fix ci js tests #6354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Once this gets merged, we can fix any remaining failing js-tests one by one. As the js-tests have not been maintained since some time, there will be a few to fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I have further investigated the js-test failure. The root cause is javascript flavor which is too new (e.g. es6, with let instead of var...) for the old webkit used by phantomjs. I have tried numerous ways/configs to generate old javascript flavors (see e.g. below). The file which gives issues is the module: {
rules: [
{
test: /\.m?jsx?$/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', {
corejs: {
version: 2,
proposals: true
},
spec: true,
modules: "umd",
useBuiltIns: 'entry',
}]
],
}
}
}
]
} |
The issue is the generation of the sanitizer/index.js file which is done one time. Then the base/security.js is injected with that file... which can not be loaded by the headless phantomjs browser used by the js-test. I have tried to tune webpack so it creates good-old javascript flavor without success. How do you see the usage of BTW webpack is not use at run-time, nor test-time AFAIK. It is just used to create the sanitizer/index.js, which itself is used at run-time and test-time. |
True, it seems like something static is needed to run after the dev build to down-convert the JS. |
yeah, this is what I am looking for now, but maybe the needed downgrade is so large that modern babel can not do that anymore... |
TypeScript also has a target option. You could write a shim file that gets transpiled by TS down to es5. |
Typescript target will act from ts->js. In our case, we already have the js in
Only
|
I am turning round and round since hours. If casperjs can not read the generated |
Works for me, as long as the sanitizer tests themselves run with the newer code. |
Closing in favor of #6356 |
Thx a lot @blink1073 for the help and ideas to find a solution. |
Partially fixes #6319 for the js-tests
Phantom.js does not seem to recognize
const
keyword. We just have to change that tovar
. No sanitizer behavior is changed with this PR.